package org.jeecg.modules.business.strategy.controller;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.jeecg.common.api.vo.Result;
import org.jeecg.modules.business.strategy.InReceiptStrategy;
import org.jeecg.modules.business.strategy.OutReceiptStrategy;
import org.jeecg.modules.business.strategy.entity.InReceiptStrategyParam;
import org.jeecg.modules.business.strategy.entity.OutReceiptStrategyParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;


/**
 * @Description: 出入库策略
 * @Author: jeecg-boot
 * @Date: 2023-11-24
 * @Version: V1.0
 */
@Api(tags = "出入库策略")
@RestController
@RequestMapping("/business/strategy")
@Slf4j
public class StrategyController {

    @Autowired
    private OutReceiptStrategy outReceiptStrategy;
    @Autowired
    private InReceiptStrategy inReceiptStrategy;

    /**
     * 出库策略
     *
     * @return
     */
    @ApiOperation(value = "出库策略", notes = "出库策略")
    @GetMapping("/out")
    public Result out(OutReceiptStrategyParam param) {
        return Result.ok(outReceiptStrategy.outReceiptStrategy(param));
    }

    /**
     * 入库策略-单据类型=纵剪入库(条料) 、一二期-四期调拨入库(条料)
     *
     * @return
     */
    @ApiOperation(value = "入库策略-单据类型=纵剪入库(条料) 、一二期-四期调拨入库(条料)", notes = "入库策略-单据类型=纵剪入库(条料) 、一二期-四期调拨入库(条料)")
    @GetMapping("/in1")
    public Result in1(List<InReceiptStrategyParam> param) {
        return Result.ok(inReceiptStrategy.stripMaterialInReceipt(param));
    }

    /**
     * 入库策略-单据类型=横剪退料(条料)
     *
     * @return
     */
    @ApiOperation(value = "入库策略-单据类型=横剪退料(条料)", notes = "入库策略-单据类型=横剪退料(条料)")
    @GetMapping("/in2")
    public Result in2(List<InReceiptStrategyParam> param) {
        return Result.ok(inReceiptStrategy.crossShearInReceipt(param));
    }

    /**
     * 入库策略-单据类型=UB调拨入库（根据接收库位判断是否需要刻痕）
     *
     * @return
     */
    @ApiOperation(value = "入库策略-单据类型=UB调拨入库（根据接收库位判断是否需要刻痕）", notes = "入库策略-单据类型=UB调拨入库（根据接收库位判断是否需要刻痕）")
    @GetMapping("/in3")
    public Result in3(List<InReceiptStrategyParam> param) {
        return Result.ok(inReceiptStrategy.allocateInReceipt(param));
    }

}
